package ma.belsoft.syga.model;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.appfuse.model.BaseObject;
import org.appfuse.model.User;

@Entity
@Table(name = "annonce")
public class Annonce extends BaseObject {

		/**
	 * 
	 */
	private static final long serialVersionUID = 3832626162173359411L;

		@Id
		@GeneratedValue(strategy=GenerationType.AUTO)
		@Column(name="annonce_id")
	  	private Long  id;
	
		@Column(name="date_diffusion")
		private Date dateDiffusion;
		
		@Column(name="active")
	    private Boolean active;
		
		@Column(name="description", length=255)
	    private String description;
		
		@ManyToOne(fetch=FetchType.EAGER, optional=false)
		@JoinColumn(name="vehicule_id")
		private Vehicule vehicule;
		
		@ManyToOne(fetch=FetchType.EAGER, optional=false)
		@JoinColumn(name="user_id")
		private User user;

		/**
		 * Constructors
		 */
	    public Annonce () {}

	    /**
	     * Getters and Setters
	     * @param id
	     */
		public Long getId() {
			return id;
		}

		public void setId(Long id) {
			this.id = id;
		}

		public Date getDateDiffusion() {
			return dateDiffusion;
		}

		public void setDateDiffusion(Date dateDiffusion) {
			this.dateDiffusion = dateDiffusion;
		}

		public Boolean getActive() {
			return active;
		}

		public void setActive(Boolean active) {
			this.active = active;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}


		@Override
		public String toString() {
			// TODO Auto-generated method stub
			return null;
		}

	
		@Override
		public boolean equals(Object o) {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public int hashCode() {
			// TODO Auto-generated method stub
			return 0;
		}

		public void setVehicule(Vehicule vehicule) {
			this.vehicule = vehicule;
		}

		public Vehicule getVehicule() {
			return vehicule;
		}

		public void setUser(User user) {
			this.user = user;
		}

		public User getUser() {
			return user;
		}

}
